package com.firewolf.permission.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.firewolf.permission.constant.ConstantUtil;
import com.firewolf.permission.entities.Function;
import com.firewolf.permission.entities.User;
import com.firewolf.permission.service.impl.UserService;

@Controller
@RequestMapping("func")
public class FunctionController {
	
	@Autowired
	private UserService uService;

	/**
	 * 根据权限查询具备的菜单
	 * 
	 * @return
	 */
	@ResponseBody
	@RequestMapping("selectFunctions")
	public List<Function> selectFuncs(HttpSession session) {
		User user = (User) session.getAttribute(ConstantUtil.CURRENR_USER);
		List<Function> fList = uService.selectFunctions(user);
		System.out.println(fList);
		return fList;
	}
}
